package com.game.logic.core.comment;

import com.xs.tool.formula.DrawCardsFormula;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Collections;
import java.util.List;

/**
 * 礼包
 * @param <T> 奖励的对象
 */
@AllArgsConstructor
@Getter
public class Bonus<T>{
    /// 分组
    int group  ;
    /// 类型 1:固定全部 2:随机一个
    int type ;
    /// 礼包的抽卡公式
    DrawCardsFormula<T> bonusPoll;
    /// <T> 奖励的对象
    List<T> bonus;

    public List<T> getBonusValue() {
        if (type == 1) {
            return bonus ;
        } if (type == 2){
            return Collections.singletonList(bonusPoll.drawSingle());
        }else {
            throw new IllegalArgumentException("type error");
        }
    }
}
